<?php
namespace cubox\provider\response;

use cubox\provider\Response; 

class Ajax extends Response{
    public static function write($data){
        $re['status']  = 'success';
        $re['msg']     = '';
        $re['content'] = '';
        $re['data']    = $data===true ? [] : $data;
        echo json_encode($re);
    }

    public static function error($msg,$data = null){
        $re['status']  = 'fail';
        $re['msg']     = $msg;
        $re['content'] = '';
        $re['data']    = $data;
        echo json_encode($re);
    }
}
